<?php

class AdminController extends Controller
{
    public function filters()
    {
        return array(
            'accessControl',
        );
    }

    public function accessRules()
    {
        return array(
            array('allow',
                'actions'=>array('index', 'kinomania'),
                'users'=>array('valerchyck'),
            ),
            array('deny',
                'actions'=>array('index', 'kinomania'),
                'users'=>array('?'),
            )
        );
    }

    public function actionSaveComment()
    {
        if (isset($_POST['comment'])){
            Feedback::model()->updateByPk($_POST['comment']['id'], array('comment'=>$_POST['comment']['text']));
        }
    }

    public function actionDeleteFeedback($id)
    {
        if (isset($_GET['ajax']))
            Feedback::model()->deleteByPk($id);
    }

    public function actionFeedback()
    {
        $model = new Feedback;
        $this->render('feedback', array('model'=>$model));
    }

	public function actionIndex()
	{
		$this->render('index');
	}

    public function actionLogout()
    {
        Yii::app()->user->logout();
        $this->redirect(Yii::app()->homeUrl);
    }
}